﻿using UnityEngine;

public class GameMenuBehaviourScript : MonoBehaviour {

	public int level;
	public int menuIndex;
	
	private int nbElements = 4;
	private float elementWidth = 0.08f;
	private float elementHeight = 0.3f;

	// Use this for initialization
	void Start () {
		float offset = 1.0f / (nbElements + 1);
		transform.localPosition = new Vector3 (offset * (menuIndex + 1) - elementWidth, elementHeight, 0.1f);
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKeyDown (KeyCode.Escape)) {
			Application.LoadLevel(Application.loadedLevel - 1); 
		}
	}

	void OnMouseDown() {
		Application.LoadLevel (level);
	}

}
